{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "bfe85fdf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1800001, 1800002, 1800003) <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "网三_学号 = (1800001,1800002,1800003)\n",
    "print(网三_学号,type(网三_学号))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "22a038c4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1900001, 1900002, 1900003) <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "网二_学号 = 1900001,1900002,1900003\n",
    "print(网二_学号,type(网二_学号))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "12038cbd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1900001"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网二_学号[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "37ad3714",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1900002, 1900003)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网二_学号[1:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c711f50f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=10, tm_mday=25, tm_hour=15, tm_min=6, tm_sec=48, tm_wday=1, tm_yday=298, tm_isdst=0)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import time\n",
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "1f973dc8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on struct_time object:\n",
      "\n",
      "class struct_time(builtins.tuple)\n",
      " |  struct_time(iterable=(), /)\n",
      " |  \n",
      " |  The time value as returned by gmtime(), localtime(), and strptime(), and\n",
      " |  accepted by asctime(), mktime() and strftime().  May be considered as a\n",
      " |  sequence of 9 integers.\n",
      " |  \n",
      " |  Note that several fields' values are not the same as those defined by\n",
      " |  the C language standard for struct tm.  For example, the value of the\n",
      " |  field tm_year is the actual year, not year - 1900.  See individual\n",
      " |  fields' descriptions for details.\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      struct_time\n",
      " |      builtins.tuple\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __reduce__(...)\n",
      " |      Helper for pickle.\n",
      " |  \n",
      " |  __repr__(self, /)\n",
      " |      Return repr(self).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |  \n",
      " |  __new__(*args, **kwargs) from builtins.type\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors defined here:\n",
      " |  \n",
      " |  tm_gmtoff\n",
      " |      offset from UTC in seconds\n",
      " |  \n",
      " |  tm_hour\n",
      " |      hours, range [0, 23]\n",
      " |  \n",
      " |  tm_isdst\n",
      " |      1 if summer time is in effect, 0 if not, and -1 if unknown\n",
      " |  \n",
      " |  tm_mday\n",
      " |      day of month, range [1, 31]\n",
      " |  \n",
      " |  tm_min\n",
      " |      minutes, range [0, 59]\n",
      " |  \n",
      " |  tm_mon\n",
      " |      month of year, range [1, 12]\n",
      " |  \n",
      " |  tm_sec\n",
      " |      seconds, range [0, 61])\n",
      " |  \n",
      " |  tm_wday\n",
      " |      day of week, range [0, 6], Monday is 0\n",
      " |  \n",
      " |  tm_yday\n",
      " |      day of year, range [1, 366]\n",
      " |  \n",
      " |  tm_year\n",
      " |      year, for example, 1993\n",
      " |  \n",
      " |  tm_zone\n",
      " |      abbreviation of timezone name\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  n_fields = 11\n",
      " |  \n",
      " |  n_sequence_fields = 9\n",
      " |  \n",
      " |  n_unnamed_fields = 0\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from builtins.tuple:\n",
      " |  \n",
      " |  __add__(self, value, /)\n",
      " |      Return self+value.\n",
      " |  \n",
      " |  __contains__(self, key, /)\n",
      " |      Return key in self.\n",
      " |  \n",
      " |  __eq__(self, value, /)\n",
      " |      Return self==value.\n",
      " |  \n",
      " |  __ge__(self, value, /)\n",
      " |      Return self>=value.\n",
      " |  \n",
      " |  __getattribute__(self, name, /)\n",
      " |      Return getattr(self, name).\n",
      " |  \n",
      " |  __getitem__(self, key, /)\n",
      " |      Return self[key].\n",
      " |  \n",
      " |  __getnewargs__(self, /)\n",
      " |  \n",
      " |  __gt__(self, value, /)\n",
      " |      Return self>value.\n",
      " |  \n",
      " |  __hash__(self, /)\n",
      " |      Return hash(self).\n",
      " |  \n",
      " |  __iter__(self, /)\n",
      " |      Implement iter(self).\n",
      " |  \n",
      " |  __le__(self, value, /)\n",
      " |      Return self<=value.\n",
      " |  \n",
      " |  __len__(self, /)\n",
      " |      Return len(self).\n",
      " |  \n",
      " |  __lt__(self, value, /)\n",
      " |      Return self<value.\n",
      " |  \n",
      " |  __mul__(self, value, /)\n",
      " |      Return self*value.\n",
      " |  \n",
      " |  __ne__(self, value, /)\n",
      " |      Return self!=value.\n",
      " |  \n",
      " |  __rmul__(self, value, /)\n",
      " |      Return value*self.\n",
      " |  \n",
      " |  count(self, value, /)\n",
      " |      Return number of occurrences of value.\n",
      " |  \n",
      " |  index(self, value, start=0, stop=9223372036854775807, /)\n",
      " |      Return first index of value.\n",
      " |      \n",
      " |      Raises ValueError if the value is not present.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(time.localtime())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "672974d5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "([1, 2, 3, 4], [3, 4, 5, 6]) <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "tuple_test = ([1,2,3,4],[3,4,5,6])\n",
    "print(tuple_test,type(tuple_test))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "94fe68ee",
   "metadata": {},
   "outputs": [],
   "source": [
    "tuple_test[0].append(100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ea8da16e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "([1, 2, 3, 4, 100], [3, 4, 5, 6])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tuple_test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "6d996814",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "([1, 2, 3, 4, 100], [3, 4, 5, 6]) <class 'tuple'> 2447010695360\n",
      "[1, 2, 3, 4, 100] 2447070161664\n"
     ]
    }
   ],
   "source": [
    "print(tuple_test,type(tuple_test),id(tuple_test))\n",
    "print(tuple_test[0],id(tuple_test[0]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "3425eae8",
   "metadata": {},
   "outputs": [],
   "source": [
    "##集合 sets (去重复)\n",
    "> 1.没有重复项\n",
    "> 2.无序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "a060a235",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['apple', 'orange', 'apple', 'pear', 'orange', 'banana']\n",
      "{'pear', 'banana', 'apple', 'orange'}\n"
     ]
    }
   ],
   "source": [
    "basket_lists = ['apple','orange','apple','pear','orange','banana']\n",
    "basket_sets = {'apple','orange','apple','pear','orange','banana'}\n",
    "print(basket_lists)\n",
    "print(basket_sets)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "5711e14a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['apple', 'orange', 'apple', 'pear', 'orange', 'banana']"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "basket_sets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "413c31f5",
   "metadata": {},
   "outputs": [],
   "source": [
    "舞蹈社 = {1801,1802,1803,1804,1805}\n",
    "电竞社 = {1801,1806,1805,1111,1113}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "7b3053a0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1801, 1805}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "舞蹈社 & 电竞社"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "ac55cc22",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1801, 1805}"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "舞蹈社.intersection(电竞社)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c22564ad",
   "metadata": {},
   "outputs": [],
   "source": [
    "#集合运算，并集\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "222991a2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1111, 1113, 1801, 1802, 1803, 1804, 1805, 1806}"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "舞蹈社 | 电竞社"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "2b7ffe12",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(舞蹈社 | 电竞社)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "858f3bc6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1111, 1113, 1801, 1802, 1803, 1804, 1805, 1806}"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "舞蹈社.union(电竞社)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "ad1c0c04",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (<ipython-input-23-924331430e4e>, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-23-924331430e4e>\"\u001b[1;36m, line \u001b[1;32m2\u001b[0m\n\u001b[1;33m    > 1.无序\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "#字典，dictionary\n",
    "> 1.无序\n",
    ">2.keys，不可变，有且唯一"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "d4f2bcb2",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新二班 = {\n",
    "    1800001:\"蔡徐坤\",\n",
    "    1800002:\"Jackz\",\n",
    "    1800003:\"Marry\",\n",
    "    1800004:\"你干嘛\"\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "caaeef7b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1800001: '蔡徐坤', 1800002: 'Jackz', 1800003: 'Marry', 1800004: '你干嘛'} <class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "print(网新二班,type(网新二班))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "859ea4c3",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1800001: ['蔡徐坤', '唱', '跳', 'Rap', 'basketball'], 1800002: 'Jackz', 1800003: 'Marry', 1800004: '你干嘛'} <class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "网新三班 = {\n",
    "    1800001:[\"蔡徐坤\",\"唱\",\"跳\",\"Rap\",\"basketball\"],\n",
    "    1800002:\"Jackz\",\n",
    "    1800003:\"Marry\",\n",
    "    1800004:\"你干嘛\"\n",
    "}\n",
    "print(网新三班,type(网新三班))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "8e70ab70",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['蔡徐坤', '唱', '跳', 'Rap', 'basketball']"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#字典取值,通过keys进行字典取值，unlike列表，元组和字符通过index取值\n",
    "网新三班[1800001]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b44c7d53",
   "metadata": {},
   "outputs": [],
   "source": [
    "#按照字典形式创建（key:value）\n",
    "#2.使用dict（）创建字典"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "96e014d2",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新四班 = dict(\n",
    "    stu1800001=\"蔡徐坤\",\n",
    "    stu1800002=\"Jackz\",\n",
    "    stu1800003=\"Marry\",\n",
    "    stu1800004=\"你干嘛\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "1b6d9f84",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stu1800001': '蔡徐坤',\n",
       " 'stu1800002': 'Jackz',\n",
       " 'stu1800003': 'Marry',\n",
       " 'stu1800004': '你干嘛'}"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新四班"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "52fe62d8",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新一班 = {}\n",
    "网新一班[\"stu1800001\"] = '蔡徐坤'\n",
    "网新一班[\"stu1800002\"] = 'Jackz'\n",
    "网新一班[\"stu1800003\"] = 'Marry'\n",
    "网新一班[\"stu1800004\"] = '你干嘛'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "750222c2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stu1800001': '蔡徐坤',\n",
       " 'stu1800002': 'Jackz',\n",
       " 'stu1800003': 'Marry',\n",
       " 'stu1800004': '你干嘛'}"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新一班"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "dd9e15cf",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新一班_keys = [\"stu1800001\",\"stu1800002\",\"stu1800003\",\"stu1800004\"]\n",
    "网新一班_values = ['蔡徐坤','Jazkz','Marry','你干嘛']\n",
    "网新一班 = {}\n",
    "for i in range(4):\n",
    "    网新一班[网新一班_keys[i]] = 网新一班_values[i]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "c6afbe9f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stu1800001': '蔡徐坤',\n",
       " 'stu1800002': 'Jazkz',\n",
       " 'stu1800003': 'Marry',\n",
       " 'stu1800004': '你干嘛'}"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新一班"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a4f29531",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
